<#macro content>
<article class="cl pd-20">
    <form action="/core/user/<#if user??>update<#else>save</#if>" method="post" class="form form-horizontal" id="form-admin-add">
        <input type="hidden" name="id" value="${(user.id)!}">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户名：</label>
            <div class="formControls col-xs-7 col-sm-8">
                <input type="text" class="input-text" value="${(user.username)!}" placeholder="" id="username" name="username">
            </div>
            <label class="form-label col-xs-1 col-sm-1"></label>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>昵称：</label>
            <div class="formControls col-xs-7 col-sm-8">
                <input type="text" class="input-text" value="${(user.nickname)!}" placeholder="" id="nickname" name="nickname">
            </div>
            <label class="form-label col-xs-1 col-sm-1"></label>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>邮箱：</label>
            <div class="formControls col-xs-7 col-sm-8">
                <input type="text" class="input-text" value="${(user.email)!}" placeholder="" id="email" name="email">
            </div>
            <label class="form-label col-xs-1 col-sm-1"></label>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>角色：</label>
            <div class="formControls col-xs-7 col-sm-8">
                <select name="roleIds" id="roleIds" multiple="multiple">
                    <#if roleList?? && roleList?size gt 0>
                    <#list roleList as r>
                    <option value="${(r.id)!}" <#if (user.roleIds)?? && (user.roleIds?split(','))?seq_contains('${(r.id)!}')>selected</#if>>${(r.name)!}</option>
                    </#list>
                    </#if>
                </select>
            </div>
            <label class="form-label col-xs-1 col-sm-1"></label>
        </div>
        <div class="row cl">
            <div class="col-xs-7 col-sm-8 col-xs-offset-4 col-sm-offset-3">
                <button class="btn btn-primary radius form-submit" type="button">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
            </div>
        </div>

    </form>
</article>
</#macro>

<#assign css>
<link rel="stylesheet" type="text/css" href="/lib/fselect/fselect.css" />
</#assign>
<#assign js>
<script type="text/javascript" src="/lib/fselect/fselect.js"></script>
<script type="text/javascript">
$(function(){
    $('.skin-minimal input').iCheck({
        checkboxClass: 'icheckbox-blue',
        radioClass: 'iradio-blue',
        increaseArea: '20%'
    });

    $('#roleIds').fSelect({
        placeholder: '请选择',
        showSearch:true, /*搜索开关*/
        searchText:'请输入搜索词'
    });
})
</script>
</#assign>
<#include "../../common/layout.html"/>